<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Test</title>
<link rel="stylesheet" href="<?php echo $this->skin?>/html.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->skin?>/admin.css" type="text/css" />
<script type="text/javascript" src="<?php echo $this->js?>/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo $this->js?>/jquery.validate.js"></script>

<script type="text/javascript">
$(document).ready(function() {
	 /**
	  * 验证执行
	  */
	  var validator = $("#loginForm").validate({
		rules: {
			uname: {
				required: true
			},
			upass: {
				required: true
			}
		},
		messages: {
			uname: {
				required: "请输入用户名"
			},
			upass: {
				required: "请输入密码"
			}
		},
		// 错误显示
		errorPlacement: function(error, element) {
			element.parent().append(error);
		},
		// 提交处理
		submitHandler: function() {
			$.ajax({
				type: "POST",
				url: "/SFramework/app/admin/public/login/do",
				data: "uname="+ $("#uname").val() +"&upass="+ $("#upass").val(),
				dataType: 'json',
				error: function(responseXML) {
					alert(responseXML.responseText);
				},
				success: function(result) {
					if (result.status == 1) {
						window.location.href = "/SFramework/app/admin/public/";
					} else {
						alert(result.message);
					}					
				}
			});
		},
		// 正确显示
		/*
		success: function(label) {
			//label.addClass("valid").text("正确");
		},
		*/
		onkeyup: false,
		onfocusout: false
	  });
});
</script>
<style type="text/css">
#loginbox{margin:50px;}
</style>
</head>
<body>

<div id="loginbox">
<form name="loginForm" id="loginForm" method="post" action="/SFramework/app/admin/public/login/do">
<dl>
    <dt>Username</dt>
        <dd><input type="text" name="uname"  id="uname"  /></dd>
    <dt>Password</dt>
        <dd><input type="password" name="upass" id="upass" /></dd>
    <dt>&nbsp;</dt>
        <dd><input type="submit" value="Login" /></dd>
</dl>
</form>
</div>


<div id="footer">
    <p>copyright&copy;Shuky</p>
</div>
</body>
</html>